From e8944ac6b07e1e01545cf82c35c1ba6d0d44642b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 30 Mar 2015 12:30:50 -0700 Subject: [PATCH] Update to rust 2015-03-30 --- Cargo.lock | 112 +++++++++++++------------- Cargo.toml | 4 +- src/cargo/core/resolver/mod.rs | 8 +- src/cargo/lib.rs | 2 +- src/cargo/util/toml.rs | 27 +++---- src/rustversion.txt | 2 +- tests/test_cargo_bench.rs | 4 +- tests/test_cargo_compile_path_deps.rs | 4 +- tests/test_cargo_compile_plugins.rs | 2 +- tests/test_cargo_test.rs | 4 +- 10 files changed, 81 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21e921a0c..fe19cc4e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,38 +2,38 @@ name = "cargo" version = "0.1.0" dependencies = [ - "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.54 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.55 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "git2-curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", - "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "registry 0.1.0", - "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "threadpool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "advapi32-sys" -version = "0.0.4" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -43,12 +43,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "curl" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -57,20 +57,20 @@ name = "curl-sys" version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.54" +version = "0.6.55" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -78,8 +78,8 @@ name = "env_logger" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -87,7 +87,7 @@ name = "flate2" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -102,7 +102,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -112,9 +112,9 @@ name = "git2-curl" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -126,19 +126,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hamcrest" version = "0.1.0" -source = "git+https://github.com/carllerche/hamcrest-rust.git#2dbf32e738935f7ebb5223b31b8fc1fe6327adf8" +source = "git+https://github.com/carllerche/hamcrest-rust.git#80e7a1cbd6db9ec20bb1d61920e55a1af91a9eb2" [[package]] name = "kernel32-sys" -version = "0.0.11" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -146,10 +146,10 @@ name = "libgit2-sys" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -166,9 +166,9 @@ name = "libssh2-sys" version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -182,10 +182,10 @@ dependencies = [ [[package]] name = "log" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -199,16 +199,16 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -228,26 +228,26 @@ name = "rand" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "registry" version = "0.1.0" dependencies = [ - "curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.7" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -273,22 +273,22 @@ name = "term" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "threadpool" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "time" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -296,7 +296,7 @@ name = "toml" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -305,14 +305,14 @@ version = "0.2.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 360ce18c5..6f8cac342 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,9 +31,9 @@ libc = "0.1.2" registry = { path = "src/registry" } [target.i686-pc-windows-gnu] -dependencies = { winapi = "0.1", advapi32-sys = "*", kernel32-sys = "*" } +dependencies = { winapi = "0.1", advapi32-sys = "0.1", kernel32-sys = "0.1" } [target.x86_64-pc-windows-gnu] -dependencies = { winapi = "0.1", advapi32-sys = "*", kernel32-sys = "*" } +dependencies = { winapi = "0.1", advapi32-sys = "0.1", kernel32-sys = "0.1" } [dev-dependencies] tempdir = "0.3" diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index ff1f0a01f..39bd9a321 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -185,7 +185,7 @@ fn activate(mut cx: Box, let mut candidates = try!(registry.query(dep)); // When we attempt versions for a package, we'll want to start at the // maximum version and work our way down. - candidates.as_mut_slice().sort_by(|a, b| { + candidates.sort_by(|a, b| { b.version().cmp(a.version()) }); let candidates = candidates.into_iter().map(Rc::new).collect::>(); @@ -196,7 +196,7 @@ fn activate(mut cx: Box, // before recursing on dependencies with more candidates. This way if the // dependency with only one candidate can't be resolved we don't have to do // a bunch of work before we figure that out. - deps.as_mut_slice().sort_by(|&(_, ref a, _), &(_, ref b, _)| { + deps.sort_by(|&(_, ref a, _), &(_, ref b, _)| { a.len().cmp(&b.len()) }); @@ -220,9 +220,7 @@ fn flag_activated(cx: &mut Context, method: &Method) -> bool { let id = summary.package_id(); let key = (id.name().to_string(), id.source_id().clone()); - let prev = cx.activations.entry(key).get().unwrap_or_else(|e| { - e.insert(Vec::new()) - }); + let prev = cx.activations.entry(key).or_insert(Vec::new()); if !prev.iter().any(|c| c == summary) { cx.resolve.graph.add(id.clone(), &[]); prev.push(summary.clone()); diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index bf57298fd..ac232f2fb 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -1,5 +1,5 @@ #![deny(unused)] -#![feature(os, std_misc, core, path_relative_from)] +#![feature(os, std_misc, core, path_relative_from, collections)] #![feature(io, str_words, exit_status, fs_time, convert)] #![cfg_attr(test, deny(warnings))] diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 9e3726c90..d41d87a15 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -764,22 +764,17 @@ fn normalize(libs: &[TomlLibTarget], let mut ret = Vec::new(); - match (libs, bins) { - ([_, ..], [_, ..]) => { - lib_targets(&mut ret, libs, metadata); - bin_targets(&mut ret, bins, - &mut |bin| Path::new("src").join("bin") - .join(&format!("{}.rs", bin.name))); - }, - ([_, ..], []) => { - lib_targets(&mut ret, libs, metadata); - }, - ([], [_, ..]) => { - bin_targets(&mut ret, bins, - &mut |bin| Path::new("src") - .join(&format!("{}.rs", bin.name))); - }, - ([], []) => () + if libs.len() > 0 && bins.len() > 0 { + lib_targets(&mut ret, libs, metadata); + bin_targets(&mut ret, bins, + &mut |bin| Path::new("src").join("bin") + .join(&format!("{}.rs", bin.name))); + } else if libs.len() > 0 && bins.len() == 0 { + lib_targets(&mut ret, libs, metadata); + } else if libs.len() == 0 && bins.len() > 0 { + bin_targets(&mut ret, bins, + &mut |bin| Path::new("src") + .join(&format!("{}.rs", bin.name))); } if let Some(custom_build) = custom_build { diff --git a/src/rustversion.txt b/src/rustversion.txt index ecc25693f..09053248b 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-03-26 +2015-03-30 diff --git a/tests/test_cargo_bench.rs b/tests/test_cargo_bench.rs index 54de09ce9..de82969ab 100644 --- a/tests/test_cargo_bench.rs +++ b/tests/test_cargo_bench.rs @@ -675,7 +675,7 @@ test!(bench_dylib { "#) .file("src/lib.rs", r#" #![feature(test)] - extern crate "bar" as the_bar; + extern crate bar as the_bar; extern crate test; pub fn bar() { the_bar::baz(); } @@ -685,7 +685,7 @@ test!(bench_dylib { "#) .file("benches/bench.rs", r#" #![feature(test)] - extern crate "foo" as the_foo; + extern crate foo as the_foo; extern crate test; #[bench] diff --git a/tests/test_cargo_compile_path_deps.rs b/tests/test_cargo_compile_path_deps.rs index 024699e53..c52889430 100644 --- a/tests/test_cargo_compile_path_deps.rs +++ b/tests/test_cargo_compile_path_deps.rs @@ -669,7 +669,7 @@ test!(path_dep_build_cmd { } "#) .file("bar/src/bar.rs.in", r#" - pub fn gimme() -> int { 0 } + pub fn gimme() -> i32 { 0 } "#); p.build(); @@ -689,7 +689,7 @@ test!(path_dep_build_cmd { // Touching bar.rs.in should cause the `build` command to run again. { let file = fs::File::create(&p.root().join("bar/src/bar.rs.in")); - file.unwrap().write_all(br#"pub fn gimme() -> int { 1 }"#).unwrap(); + file.unwrap().write_all(br#"pub fn gimme() -> i32 { 1 }"#).unwrap(); } assert_that(p.cargo("build"), diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index 938487a5a..24931eb1b 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -72,7 +72,7 @@ test!(plugin_to_the_max { name = "baz" crate_type = ["dylib"] "#) - .file("src/lib.rs", "pub fn baz() -> int { 1 }"); + .file("src/lib.rs", "pub fn baz() -> i32 { 1 }"); bar.build(); baz.build(); diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index 401ca3ba5..6cec47e39 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -659,7 +659,7 @@ test!(test_dylib { path = "bar" "#) .file("src/lib.rs", r#" - extern crate "bar" as the_bar; + extern crate bar as the_bar; pub fn bar() { the_bar::baz(); } @@ -667,7 +667,7 @@ test!(test_dylib { fn foo() { bar(); } "#) .file("tests/test.rs", r#" - extern crate "foo" as the_foo; + extern crate foo as the_foo; #[test] fn foo() { the_foo::bar(); } -- 2.30.2